package com.dinstar.dinlink.utils;

import android.content.Context;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.util.Log;

import org.linphone.core.Content;


public class BaseUtils {


    public static String getVersion(Context content){
        String version = null;
        try {
            PackageInfo packageInfo = content.getPackageManager().getPackageInfo(content.getPackageName(), 0);
            int versionCode = packageInfo.versionCode; // 版本号（整数）
            String versionName = packageInfo.versionName; // 版本名称（字符串）
            // 输出版本号和版本名称
            Log.d("VersionInfo", "Version Code: " + versionCode);
            Log.d("VersionInfo", "Version Name: " + versionName);
            version = packageInfo.versionCode+"_"+versionName;
        } catch (PackageManager.NameNotFoundException e) {
            Log.e("VersionInfo", "Failed to get package info", e);
        }
        return version;

    }
}
